package com.blue.user.controller;

import com.blue.user.service.LitUserService;
import com.litblue.api.client.GetArtWorkClient;
import com.litblue.starter.core.AjaxResult;
import com.litblue.starter.pojo.user.domian.LitUserInfo;
import com.litblue.starter.pojo.user.dto.LitUserInfoDto;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;


@RestController
@RequestMapping("/user/info")
@RequiredArgsConstructor(onConstructor_ = @Autowired)
public class LitUserInfoController {
    private final LitUserService litUserService;

    private final GetArtWorkClient getArtWorkClient;

    @ApiOperation(value = "获取手机验证码")
    @GetMapping("genPhoneCode")
    public AjaxResult getPhoneCode(String phone) {
        return litUserService.genPhoneCode(phone);
    }
    @PostMapping("loginUser")
    public AjaxResult loginUser(@RequestBody LitUserInfoDto litUserInfoDto) {
        return litUserService.loginUser(litUserInfoDto);
    }

    @ApiOperation("编辑信息")
    @PostMapping("editUserInfo")
    public AjaxResult editUserInfo(@RequestBody LitUserInfo litUserInfo){
        return litUserService.editUserInfo(litUserInfo);
    }
    @PostMapping("queryUserInfo")
    public LitUserInfo queryUserInfo(Long id){
        return litUserService.queryUserInfo(id);
    }

    @GetMapping("test")
    public String getTestContent() {
        return getArtWorkClient.getTestContent();
    }

}
